﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace LiteratureManage.Web.Initialization
{
    using AutoMapper;
    using LiteratureManage.Domain.Models;

    public class AutoMapperConfiguration
    {
        public static void Configure()
        {
            Mapper.CreateMap<Literature, Literature>()
                .ForMember(x => x.Id, o => o.UseDestinationValue())
                .ForMember(x => x.Authors, o => o.UseDestinationValue())
                .ForMember(x => x.CreateDate, o => o.UseDestinationValue())
                .ForMember(x => x.UpdateDate, o => o.UseValue(DateTime.Now));

            Mapper.CreateMap<Author, Author>()
                .ForMember(x => x.Literature, o => o.UseDestinationValue());
        }
    }
}
